Skip to content

Allow command calls in endless method bodies regardless of context#3598

Merged
tenderlove merged 1 commit into
ruby:mainfrom
Shopify:fix-3473
Jul 17, 2025
Merged

Allow command calls in endless method bodies regardless of context#3598
tenderlove merged 1 commit into
ruby:mainfrom
Shopify:fix-3473

Conversation

@st0012

@st0012 st0012 commented Jul 17, 2025

Copy link
Copy Markdown
Member

Previously, endless method definitions like x = def f = p 1 would fail to parse because command calls (method calls without parentheses) were only accepted when the surrounding binding power was less than PM_BINDING_POWER_COMPOSITION (8). In assignment contexts with binding power 18, this condition was false, causing parse errors.

This fix ensures command calls are always accepted in endless method bodies by passing true for accepts_command_call, making the method body parse consistently regardless of where the method is defined.

Fixes #3473

Previously, endless method definitions like `x = def f = p 1` would fail
to parse because command calls (method calls without parentheses) were
only accepted when the surrounding binding power was less than
`PM_BINDING_POWER_COMPOSITION` (8). In assignment contexts with binding
power 18, this condition was false, causing parse errors.

This fix ensures command calls are always accepted in endless method
bodies by passing `true` for `accepts_command_call`, making the method
body parse consistently regardless of where the method is defined.
@tenderlove
tenderlove merged commit bc446fb into ruby:main Jul 17, 2025
56 checks passed
@st0012
st0012 deleted the fix-3473 branch July 17, 2025 16:14
tenderlove added a commit that referenced this pull request Jul 17, 2025
This reverts commit bc446fb, reversing
changes made to 71432af.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should parse x = def f = p 1

2 participants